---
---
<section class="categories">
  {% assign categories = site.categories | sort %}
  {% for category in categories %}
    {% assign name = category[0] %}
    {% assign posts = category[1] %}
    {% assign size = posts | size %}
    <section class="category">
      <h3>
        {% if site.active_lang == "en" %}
          <a href="{{ site.url }}/en/category/{{ name | slugify }}/">{{ name | replace: "-", " "}}</a>
        {% else %}
          <a href="{{ site.url }}/category/{{ name | slugify }}/">{{ name | replace: "-", " " }}</a>
        {% endif %}
      </h3>

      <ul>
        {% assign tutorials = posts | sort: "title" %}
        {% for tutorial in tutorials limit: 4 %}
          <li><a href="{{ site.url }}{{ tutorial.url }}">{% include document-icon.html icon=tutorial.type %}{{ tutorial.title }}</a></li>
        {% endfor %}
        {% if size > 4 %}
          <li><a href="{{ site.url }}/category/{{ name | slugify }}/">{{ size | minus: 4 }} more...</a></li>
        {% endif %}
      </ul>
    </section>
  {% endfor %}
</section>
